// 1. 引入Vur Router中的函数
import {createRouter,createWebHashHistory,createWebHistory} from 'vue-router';

// 2. 引入路由组件(页面组件)
import AdminHomePage from "../views/HomePage.vue"
import LoginPage from "../views/LoginPage.vue"
import StudentListPage from "../views/StudentListPage.vue"
import CourseListPage from "../views/CourseListPage.vue"
// import LoginPage from "../views/LoginPage.vue"


// 3. 定义路由信息
const routes = [

	{
		"path" : "/home",
		"name" : "home",
		"component": AdminHomePage,	
		"children":[{
			"path":"/home/students",
			"component": StudentListPage
		},
		{
			"path":"/home/courses",
			"component": CourseListPage
		}
		]
	},
	{
		"path" : "/",
		"name" : "default",
		"component": LoginPage,
	},

]

// 4. 创建一个存放路由历史信息的对象
const history = createWebHashHistory();  // #		兼容性更好
// const history = createWebHistory();   // 没有#   (对服务器和浏览器有要求)


// 5. 创建路由对象
const router = createRouter({
	history,
	routes,
});

// 6. 导出路由对象
export default router;